package com.github.catvod.spider.merge;

import com.github.catvod.spider.merge.XR;
import com.github.catvod.spider.merge.ms;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import javax.annotation.Nullable;

/* loaded from: classes.dex */
public class HZ extends Lm {
    private static final ms oq = new ms.aF("title");
    private Tw F8;
    private boolean i4;
    private final String iU;
    private yh n;
    private F t;

    public static class Tw implements Cloneable {

        @Nullable
        XR.yh q;
        private XR.HA h = XR.HA.base;
        private Charset V0 = Uu.V0;
        private final ThreadLocal<CharsetEncoder> j = new ThreadLocal<>();
        private boolean I = true;
        private boolean oC = false;
        private int BQ = 1;
        private EnumC0010Tw W = EnumC0010Tw.html;

        /* renamed from: com.github.catvod.spider.merge.HZ$Tw$Tw, reason: collision with other inner class name */
        public enum EnumC0010Tw {
            html,
            xml
        }

        public boolean BQ() {
            return this.oC;
        }

        public XR.HA I() {
            return this.h;
        }

        public EnumC0010Tw Qy() {
            return this.W;
        }

        public Tw V0(Charset charset) {
            this.V0 = charset;
            return this;
        }

        CharsetEncoder W() {
            CharsetEncoder newEncoder = this.V0.newEncoder();
            this.j.set(newEncoder);
            this.q = XR.yh.h(newEncoder.charset().name());
            return newEncoder;
        }

        public Tw h(String str) {
            V0(Charset.forName(str));
            return this;
        }

        /* renamed from: j, reason: merged with bridge method [inline-methods] */
        public Tw clone() {
            try {
                Tw tw = (Tw) super.clone();
                tw.h(this.V0.name());
                tw.h = XR.HA.oq(this.h.name());
                return tw;
            } catch (CloneNotSupportedException e) {
                throw new RuntimeException(e);
            }
        }

        public int oC() {
            return this.BQ;
        }

        CharsetEncoder q() {
            CharsetEncoder charsetEncoder = this.j.get();
            return charsetEncoder != null ? charsetEncoder : W();
        }

        public boolean u() {
            return this.I;
        }
    }

    public enum yh {
        noQuirks,
        quirks,
        limitedQuirks
    }

    public HZ(String str) {
        super(iP.iU("#root", Qg.h), str);
        this.F8 = new Tw();
        this.n = yh.noQuirks;
        this.i4 = false;
        this.iU = str;
        this.t = F.V0();
    }

    public HZ Kd(yh yhVar) {
        this.n = yhVar;
        return this;
    }

    @Override // com.github.catvod.spider.merge.Lm
    /* renamed from: Kg, reason: merged with bridge method [inline-methods] and merged with bridge method [inline-methods] and merged with bridge method [inline-methods] */
    public HZ oq() {
        HZ hz = (HZ) super.oq();
        hz.F8 = this.F8.clone();
        return hz;
    }

    public F L0() {
        return this.t;
    }

    @Override // com.github.catvod.spider.merge.Lm, com.github.catvod.spider.merge.fa
    public String PU() {
        return "#document";
    }

    public Tw TD() {
        return this.F8;
    }

    public HZ U(F f) {
        this.t = f;
        return this;
    }

    public yh pW() {
        return this.n;
    }

    @Override // com.github.catvod.spider.merge.fa
    public String w4() {
        return super.yp();
    }
}
